home *** CD-ROM | disk | FTP | other *** search
/ Aminet 12 / Aminet 12 (1996)(GTI - Schatztruhe)[!][Jun 1996].iso / Aminet / dev / lang / HeliOS3.lha / helios_demo_disk3 / source / Demo4_MultiSprites.src < prev    next >
Encoding:
Text File  |  1995-11-11  |  18.3 KB  |  701 lines

  1.  
  2.   \ ***********************************************************
  3.   \
  4.   \                    MULTI SPRITES DEMO
  5.   \
  6.   \ ***********************************************************
  7.   \
  8.   \ This code demonstrates how to create simple HeliOS multi
  9.   \ sprites (or BOBs to be precise) and move them around.
  10.   \
  11.   \ This code builds upon the following Demos:
  12.   \
  13.   \ Demo1_SinglePF.src
  14.   \ Demo2_SinglePFCopper.src
  15.   \ Demo3_SimpleSprite.src
  16.   \
  17.   \ This code is then expanded in the following Demos:
  18.   \
  19.   \ Demo5_MultiSptCollide.src
  20.   \ Demo6_SimpleAnim.src
  21.   \ Demo7_MultiAnim.src
  22.   \
  23.   \ ***********************************************************
  24.  
  25.  
  26.  
  27.   \ ***********************************************************
  28.   \ Re-initialise HeliOS dictionary to standard CORE vocabulary
  29.   \ ***********************************************************
  30.  
  31.   \ This should always be used at the start of any program which
  32.   \ is to be repeatedly recompiled.
  33.  
  34.   FORGET **CORE**
  35.  
  36.   \ *************************
  37.   \ Load include symbol files
  38.   \ *************************
  39.   \
  40.   \ These "include files" are pre-compiled (for speed) versions of the
  41.   \ Amiga includes and the Helios system includes.
  42.   \
  43.   \ Uncomment the lines below for standalone compilation, but otherwise
  44.   \ it is better to set these include files from the Helios Forth menus
  45.  
  46.   AMIGAINCLUDE HeliOS:HeliOS_AmigaInclude
  47.   USERINCLUDE  HeliOS:HeliOS_UserInclude
  48.  
  49.   \ ****************************************
  50.   \ Create display imagery file name strings
  51.   \ ****************************************
  52.  
  53.   \ These files are ordinary IFF's (and may be "PowerPacked" if required)
  54.   \
  55.   \ The pictures here will be loaded into each of the display BitMaps.
  56.   \
  57.  
  58.   $CONSTANTL Slice1Pic $Helios:Source/Data/Pic1$
  59.  
  60.   \ **************************************
  61.   \ Create display configuration constants
  62.   \ **************************************
  63.   \
  64.   \ Collect all "display-specific" parameters here and generate "named"
  65.   \ constants which make references easier than using numeric values.
  66.   \
  67.   \ Collecting these together here makes it easier to adjust things at any
  68.   \ time without having to search source code to replace values individually.
  69.   \
  70.  
  71.  
  72.   256                      CONSTANT DisplayHeight      \ Full PAL display
  73.   320                      CONSTANT DisplayWidth       \ Lores display
  74.   44                       CONSTANT DisplayTopLine     \ Display start
  75.  
  76.   DisplayWidth             CONSTANT Slice1Width        \ Lores width
  77.   DisplayWidth 32 +        CONSTANT Slice1RasterWidth  \ Raster=SWidth+32
  78.   DisplayHeight            CONSTANT Slice1Height       \ Slice height
  79.   DisplayHeight 32 +       CONSTANT Slice1RasterHeight \ Slice Raster=DHgt+32
  80.   0                        CONSTANT Slice1Mode         \ Lores
  81.   3                        CONSTANT Slice1Planes       \ Slice bitplanes
  82.  
  83.   \ The calculation below takes the number of bitplanes and calculates
  84.   \ how many colours this represents.
  85.   \
  86.   \ One bitplane gives two colours.
  87.   \
  88.   \ Each additional bitplane multiplies the number of colours by two.
  89.   \
  90.   \ Performing a single LSL operation on any number multipies by 2, so we
  91.   \ have a quick method of multiplying by two for our colour calculation.
  92.   \
  93.   \ In this case, we need "2 to the power 3", which is 2*2*2=8.
  94.   \
  95.   \ e.g.                              2*2*2
  96.   \                                   ^ ^ ^
  97.   \                                   Total number of planes = 3
  98.   \
  99.   \
  100.   \ So, we take the first value two
  101.   \
  102.   \ e.g.                              2*2*2
  103.   \                                   ^
  104.   \                                  Initial start value of 2
  105.   \
  106.   \ and we now need to multiply it by two "the_number_of_planes minus_one"
  107.   \ more times.
  108.   \
  109.   \ e.g.                              2*2*2
  110.   \                                     ^ ^
  111.   \                                     Total planes minus one
  112.   \
  113.   \
  114.   \ So, Number of colours = 2 operated on by LSL NumberOfPlanes-1 times.
  115.   \
  116.  
  117.   2 Slice1Planes 1- LSL    CONSTANT Slice1Colours      \ A-slice colours
  118.  
  119.   \ ***********************
  120.   \ Error handling routines
  121.   \ ***********************
  122.  
  123.   \ This error handler allows all errors to be routed via a comprehensive
  124.   \ sequential closedown routine, which is associated with the HeliOS
  125.   \ system error handler word ERROR".
  126.   \
  127.   \ When ERROR" senses an error, it prints an associated error message
  128.   \ delimited by '"' characters, and then closes everything down using the
  129.   \ routine CLOSEDOWN below which you have supplied.
  130.   \
  131.   \ This simplifies errors checks to the use of a single word, ERROR", which
  132.   \ displays a text message and closes eveything down.
  133.   \
  134.  
  135.   0 VARIABLE (CLOSEDOWN)
  136.  
  137.   : ?CLOSEDOWNERROR
  138.  
  139.   IF
  140.     CR
  141.     CR
  142.     TYPE
  143.     CR
  144.     CR
  145.     ." Press <Space> to quit!"
  146.     CR
  147.     CR
  148.     WAITSPACE
  149.     (CLOSEDOWN) @EXECUTE
  150.     QUIT
  151.   ELSE
  152.     DDROP
  153.   THEN
  154.   ;
  155.  
  156.   LATESTCFA VARIABLE ERROR1
  157.  
  158.   \ ****************************************
  159.   \ Create display pointer storage variables
  160.   \ ****************************************
  161.  
  162.   \ Here we create a set of "pointers", initially set to a "null" value.
  163.   \
  164.   \ These "pointers" are set up as "long addresses" when various components
  165.   \ of the display system are allocated and initialised.
  166.   \
  167.   \ Note that initially these are all set to zero, and we clear them back
  168.   \ to zero when we de-allocate the associated resource.
  169.   \
  170.   \ These DPOINTERs are all initially set to "null" by using '0.'.
  171.   \
  172.   \ When we allocate memory or Amiga system resources in the program at
  173.   \ run-time, these pointers are updated to contain the 32-bit address
  174.   \ of the newly allocated resource.
  175.   \
  176.   \ Subsequently the symbolic DPOINTER name can be used in your code to
  177.   \ represent the associated address.
  178.  
  179.   0. DPOINTER Display1             \ Main Display structure pointer
  180.   0. DPOINTER Slice1               \ Slice 1 Slice structure pointer
  181.  
  182.   0. DPOINTER Slice1_ColorMap      \ Slice 1 ColourMap structure pointer
  183.  
  184.   0. DPOINTER Slice1_RasInfo       \ Slice 1 RasInfo structure pointer
  185.  
  186.   0. DPOINTER Slice1_BMap          \ Slice 1 BitMap structure pointer
  187.  
  188.   0. DPOINTER Slice1_SliceControl  \ Slice 1 SliceControl structure pointer
  189.  
  190.   \ *************
  191.   \ Colour tables
  192.   \ *************
  193.  
  194.   \ Each colour entry requies 2 bytes of storage space
  195.  
  196.   CREATEL Slice1_ColorTable        \ Create longword pointer to table
  197.   Slice1Colours 2* 0 ALLOTFILL     \ Allocate Slice1 colours * 2 bytes
  198.  
  199.  
  200.   \ *************************************
  201.   \ Copper strip for graduated background
  202.   \ *************************************
  203.  
  204.   0. DVARIABLE Copper              \ 32-bit CopperList pointer store
  205.   0. DVARIABLE CopperLength        \ 32-bit CopperList length store
  206.  
  207.   : AddCopper                      \ Add custom copper list to display
  208.  
  209.   Display1                         \ We are adding CopperList to Display1
  210.   Copper D@
  211.   ADDCOPPERSTRIP
  212.   SORTSTRIPTABLE
  213.   LINKSTRIPS
  214.   DDROP
  215.   ;
  216.  
  217.   : RemCopper                      \ Remove custom copper list from display
  218.  
  219.   Display1                         \ We are removing CopperList from Display1
  220.   Copper D@
  221.   DFLAG
  222.   IF
  223.     REMCOPPERSTRIP
  224.     LINKSTRIPS
  225.     DDROP
  226.   ELSE
  227.     DDDROP
  228.   THEN
  229.   ;
  230.  
  231.   : Create_Copper
  232.  
  233.   COPPERSTART
  234.   Copper D!
  235.   0 [ DECIMAL ]  45 [ HEX ] FFFE COPPERWAIT  DROP   0100 18E COPPERMOVE  DROP
  236.   0 [ DECIMAL ]  60 [ HEX ] FFFE COPPERWAIT  DROP   0200 18E COPPERMOVE  DROP
  237.   0 [ DECIMAL ]  75 [ HEX ] FFFE COPPERWAIT  DROP   0300 18E COPPERMOVE  DROP
  238.   0 [ DECIMAL ]  90 [ HEX ] FFFE COPPERWAIT  DROP   0400 18E COPPERMOVE  DROP
  239.   0 [ DECIMAL ] 105 [ HEX ] FFFE COPPERWAIT  DROP   0500 18E COPPERMOVE  DROP
  240.   0 [ DECIMAL ] 120 [ HEX ] FFFE COPPERWAIT  DROP   0600 18E COPPERMOVE  DROP
  241.   0 [ DECIMAL ] 135 [ HEX ] FFFE COPPERWAIT  DROP   0700 18E COPPERMOVE  DROP
  242.   0 [ DECIMAL ] 150 [ HEX ] FFFE COPPERWAIT  DROP   0800 18E COPPERMOVE  DROP
  243.   0 [ DECIMAL ] 165 [ HEX ] FFFE COPPERWAIT  DROP   0900 18E COPPERMOVE  DROP
  244.   0 [ DECIMAL ] 180 [ HEX ] FFFE COPPERWAIT  DROP   0A00 18E COPPERMOVE  DROP
  245.   0 [ DECIMAL ] 195 [ HEX ] FFFE COPPERWAIT  DROP   0B00 18E COPPERMOVE  DROP
  246.   0 [ DECIMAL ] 210 [ HEX ] FFFE COPPERWAIT  DROP   0C00 18E COPPERMOVE  DROP
  247.   0 [ DECIMAL ] 225 [ HEX ] FFFE COPPERWAIT  DROP   0D00 18E COPPERMOVE  DROP
  248.   0 [ DECIMAL ] 240 [ HEX ] FFFE COPPERWAIT  DROP   0E00 18E COPPERMOVE  DROP
  249.   0 [ DECIMAL ] 255 [ HEX ] FFFE COPPERWAIT  DROP   0F00 18E COPPERMOVE  DROP
  250.   [ DECIMAL ]
  251.   COPPEREND
  252.   CopperLength D!   Copper D!
  253.   ADDCOPPER
  254.   ;
  255.  
  256.   : Free_Copper                  \ Closes down and frees copperlist memory
  257.  
  258.   RemCopper
  259.   Copper D@ FREEMEMORY
  260.   ;
  261.  
  262.   \ ***********************************
  263.   \ Create Display and Slice structures
  264.   \ ***********************************
  265.  
  266.   \ This routine simply makes blank structures, which then need to be
  267.   \ initialised later (in the CREATE_DISPLAY routine).
  268.  
  269.   : CREATE_DSLICES
  270.  
  271.   DS_SIZEOF MAKESTRUCTURE Display1 MAKEPOINTER  \ Main "Display" structure
  272.  
  273.   SL_SIZEOF MAKESTRUCTURE Slice1   MAKEPOINTER  \ Display "Slice" structure
  274.   ;
  275.  
  276.   : FREE_DSLICES
  277.  
  278.   Slice1    DDUP FREEMEMORY   CLEARPOINTER
  279.   Display1  DDUP FREEMEMORY   CLEARPOINTER
  280.   ;
  281.  
  282.   \ ******************************
  283.   \ Create RasInfo structures etc.
  284.   \ ******************************
  285.  
  286.   : CREATE_RASINFO
  287.  
  288.   \ First allocate and initialise complete RasInfo structures.
  289.   \
  290.   \ This routine automatically allocates all BitMaps etc.
  291.   \
  292.  
  293.   Slice1RasterWidth Slice1RasterHeight Slice1Planes  OPENRASINFO
  294.   DFLAG0= ERROR" Fail: RasInfo1"
  295.   Slice1_RasInfo MAKEPOINTER
  296.  
  297.   \ Set invisible area "sprite margins" for slice RasInfo
  298.  
  299.   16              Slice1_RasInfo         ri_RxOffset    INDEX!L
  300.   16              Slice1_RasInfo         ri_RyOffset    INDEX!L
  301.  
  302.   \ Store BitMap pointer - often useful for later reference
  303.  
  304.   Slice1_RasInfo  ri_BitMap INDEXD@L Slice1_BMap MAKEPOINTER
  305.   ;
  306.  
  307.   : FREE_RASINFO
  308.  
  309.   Slice1_RasInfo   DDUP CLOSERASINFO   CLEARPOINTER
  310.   ;
  311.  
  312.   \ ********************************
  313.   \ Create Display/Slice Copperlists
  314.   \ ********************************
  315.  
  316.   \ This function builds the main display copperlist by:
  317.   \
  318.   \ 1. Initialising the Slice data structure
  319.   \ 2. Calling MAKECOPSTRIP for the slice, to build a copperlist
  320.   \ 3. Calling MAKEDISPLAY to build the master Display copperlist
  321.   \
  322.  
  323.   : CREATE_DISPLAY
  324.  
  325.   \ First initialise main display structures
  326.  
  327.   Slice1                           Display1  DS_Slice     INDEXD!L
  328.  
  329.   Slice1Width                      Slice1    SL_DWidth    INDEX!L
  330.   Slice1Height                     Slice1    SL_DHeight   INDEX!L
  331.   DisplayTopLine                   Slice1    SL_DyOffset  INDEX!L
  332.   Slice1_RasInfo                   Slice1    SL_RasInfo   INDEXD!L
  333.   Slice1_ColorMap                  Slice1    SL_ColorMap  INDEXD!L
  334.   Slice1Mode                       Slice1    SL_Modes     INDEX!L
  335.  
  336.   \ Generate copper list information for each of the display slices
  337.  
  338.   Slice1 MAKECOPSTRIP
  339.   D0= ERROR" Fail: Slice1CopStrip"
  340.  
  341.   \ Make display
  342.  
  343.   Display1 MAKEDISPLAY
  344.   D0= ERROR" Fail: Display1"
  345.   ;
  346.  
  347.   : FREE_DISPLAY
  348.  
  349.   Display1                 FREEDISPLAY
  350.   Slice1                   FREECOPSTRIP
  351.   ;
  352.  
  353.   \ ********************************************************
  354.   \ Create SliceControl structures for double buffered slice
  355.   \ ********************************************************
  356.  
  357.   \ SliceControl structures are used to control any slices which perform
  358.   \ mapping or scrolling functions, or which require double or triple
  359.   \ playfield buffering.
  360.   \
  361.   \ In this case we have one slice which does not scroll, is not mapped,
  362.   \ but IS double buffered.
  363.   \
  364.  
  365.   : CREATE_SLICECONTROL
  366.  
  367.   \ Make SliceControl for double buffered bitmap display
  368.  
  369.   Slice1  0 0 MAKESLICECONTROL
  370.   DFLAG0= ERROR" Fail: SliceControl1"
  371.   Slice1_SliceControl MAKEPOINTER
  372.  
  373.   \ Install slice controls into HeliOS display control system
  374.  
  375.   Slice1_SliceControl  INSTALLSLICECONTROL
  376.   ;
  377.  
  378.   : FREE_SLICECONTROL
  379.  
  380.   CLEARSLICECONTROLS
  381.   Slice1_SliceControl  CLOSESLICECONTROL
  382.   ;
  383.  
  384.   \ These routines load an IFF picture into supplied BitMap, and correctly
  385.   \ initialises the supplied ColorTable.
  386.   \
  387.   \ The ColorTable is then used to create an initialised ColorMap structure.
  388.   \
  389.  
  390.   : CREATE_IMAGERY
  391.  
  392.   Slice1_BMap
  393.   Slice1_ColorTable
  394.   Slice1Pic
  395.   10 2 DOSLIB                        \ Call to internal HeliOS library
  396.   10 <> ERROR" Fail: Slice1Pic"
  397.  
  398.   Slice1_ColorTable  Slice1Colours MAKECOLORMAP  \ Allocate ColourMap
  399.   DFLAG0= ERROR" Fail: Slice1ColorMap"
  400.   Slice1_ColorMap MAKEPOINTER
  401.   ;
  402.  
  403.   : FREE_IMAGERY
  404.  
  405.   Slice1_ColorMap  DDUP FREECOLORMAP  CLEARPOINTER
  406.   ;
  407.  
  408.   \ *****************
  409.   \ Multi Sprite Demo
  410.   \ *****************
  411.  
  412.   \ ***************************
  413.   \ Multi Sprite Demo constants
  414.   \ ***************************
  415.  
  416.   \ Set up a number of constants which determine various aspects of the
  417.   \ demo, e.g. How many Bullets required
  418.   \
  419.   \ Change these values as required
  420.   \
  421.  
  422.   25 CONSTANT Bullet#              \ Number of Bullets available
  423.   8  CONSTANT BulletSpeed          \ Speed of Bullet
  424.   6  CONSTANT FiringRate           \ Speed of gun reload
  425.   4  CONSTANT GunSpeed             \ Speed of Gun movement
  426.  
  427.   \ *******************************************************
  428.   \ Create multi sprite demo pointers and storage variables
  429.   \ *******************************************************
  430.  
  431.   0. DPOINTER GunSpriteSet         \ Gun sprite image
  432.   0. DPOINTER BulletSpriteSet      \ Bullet sprite image
  433.  
  434.   CREATE BulletTable               \ Bullet sprite pointer storage table.
  435.   Bullet# 4* 0 ALLOTFILL           \ Space allocated = Number_of_Bullets*4
  436.                                    \ This table has to hold a number of
  437.                                    \ 32-bit (4-byte) numbers, because
  438.                                    \ each Bullet sprite is a 32-bit pointer
  439.  
  440.   0 VARIABLE     FireTimer         \ Gun reload rate store
  441.  
  442.   \ ****************
  443.   \ Boundary routine
  444.   \ ****************
  445.  
  446.   \ Remove Bullet - called when bullet hits boundary at edge of display
  447.  
  448.   : BulletRemove
  449.  
  450.   RemoveSprite
  451.   ;
  452.  
  453.   \ ****************************
  454.   \ User input response routines
  455.   \ ****************************
  456.  
  457.   : Fire
  458.  
  459.   RAWKEY @ 64 =
  460.   JOY1FIRE OR
  461.   IF
  462.     FireTimer @ 0<
  463.     IF
  464.       FiringRate FireTimer !
  465.       Bullet# 0
  466.       DO
  467.         BulletTable I 4* + D@ SETSTRUCTURE1
  468.         SpriteCtrl_Running STRUCTURE1 @L 0=
  469.         IF
  470.           1 SpriteCtrl_Running STRUCTURE1 !L
  471.           GunSpriteSet 8. D+ D@L SETSTRUCTURE2
  472.  
  473.           SpriteCtrl_XPos STRUCTURE2 @L 5 +
  474.           SpriteCtrl_XPos STRUCTURE1 !L
  475.  
  476.           SpriteCtrl_YPos STRUCTURE2 @L 2 -
  477.           SpriteCtrl_YPos STRUCTURE1 !L
  478.  
  479.           SpriteCtrl_UserData1 STRUCTURE1
  480.           SpriteCtrl_YAdd STRUCTURE1 D!L
  481.  
  482.           BulletSpeed NEGATE SpriteCtrl_UserData1 STRUCTURE1 !L
  483.  
  484.           1 SpriteCtrl_CollFlag STRUCTURE1 !L
  485.           1 SpriteCtrl_Flags STRUCTURE1 !L
  486.  
  487.           0. STRUCTURE1 INSTALLSPRITE
  488.           LEAVE
  489.         THEN
  490.       LOOP
  491.     ELSE
  492.       FireTimer DEC
  493.     THEN
  494.   THEN
  495.   ;
  496.  
  497.   : MoveGun
  498.  
  499.   RAWKEY @ 78 =
  500.   JOY1LEFTRIGHT 0>
  501.   OR
  502.   IF
  503.      GunSpeed
  504.      19 320
  505.      GunSpriteSet 8. D+ D@L SpriteCtrl_XPos D+
  506.      LIMIT+!L
  507.   ELSE
  508.     RAWKEY @ 79 =
  509.     JOY1LEFTRIGHT 0<
  510.     OR
  511.     IF
  512.      GunSpeed NEGATE
  513.      19 320
  514.      GunSpriteSet 8. D+ D@L SpriteCtrl_XPos D+
  515.      LIMIT+!L
  516.     THEN
  517.   THEN
  518.   ;
  519.  
  520.   \ *********************
  521.   \ Create sprite objects
  522.   \ *********************
  523.  
  524.   : CREATE_SPRITES
  525.  
  526.   \ ----------
  527.   \ Gun sprite
  528.   \ ----------
  529.  
  530.   Slice1_BMap
  531.   154 272
  532.   13 15
  533.   1
  534.   MAKESPRITESET
  535.   DFLAG0= ERROR" Fail: Gun SpriteSet"
  536.   GunSpriteSet MAKEPOINTER
  537.  
  538.   GunSpriteSet 8. D+ D@L
  539.   DDUP  SpriteCtrl_XPos D+       170 -ROT !L
  540.         SpriteCtrl_YPos D+       239 -ROT !L
  541.  
  542.   Slice1_SliceControl   GunSpriteSet    INITSPRITESET
  543.  
  544.   \ -------------
  545.   \ Bullet sprite
  546.   \ -------------
  547.  
  548.   Slice1_BMap
  549.   159 279
  550.   3 7
  551.   1
  552.   MAKESPRITESET
  553.   DFLAG0= ERROR" Fail: Bullet SpriteSet"
  554.   BulletSpriteSet MAKEPOINTER
  555.  
  556.   Slice1_SliceControl   BulletSpriteSet    INITSPRITESET
  557.  
  558.   Bullet# 0
  559.   DO
  560.     BulletSpriteSet 8. D+ D@L CLONESPRITE
  561.     DFLAG0= ERROR" Fail: Bullet Sprite"
  562.     DDUP BulletTable I 4* + D!
  563.     SETSTRUCTURE1
  564.  
  565.     -2                     SpriteCtrl_VisiZone       STRUCTURE1 !L
  566.     4                      SpriteCtrl_LeftZone       STRUCTURE1 !L
  567.     4                      SpriteCtrl_RightZone      STRUCTURE1 !L
  568.     4                      SpriteCtrl_UpZone         STRUCTURE1 !L
  569.     10                     SpriteCtrl_DownZone       STRUCTURE1 !L
  570.     ' BulletRemove CFA     SpriteCtrl_VisiForth      STRUCTURE1 !L
  571.   LOOP
  572.   ;
  573.  
  574.   : FREE_SPRITES
  575.  
  576.   Bullet# 0
  577.   DO
  578.     Bullet# 1- I - 4* BulletTable + DUP
  579.     D@ FREESPRITE
  580.     D0!
  581.   LOOP
  582.  
  583.   BulletSpriteSet DDUP FREESPRITESET CLEARPOINTER
  584.   GunSpriteSet    DDUP FREESPRITESET CLEARPOINTER
  585.   ;
  586.  
  587.   \ *********************
  588.   \ Close down everything
  589.   \ *********************
  590.  
  591.   : CLOSEDOWN
  592.  
  593.   FREE_SPRITES
  594.   FREE_COPPER
  595.   FREE_SLICECONTROL
  596.   FREE_DISPLAY
  597.   FREE_IMAGERY
  598.   FREE_RASINFO
  599.   FREE_DSLICES
  600.   RESETERROR"
  601.   ;
  602.  
  603.   LATESTCFA (CLOSEDOWN) !
  604.  
  605.   : TestDisplay          \ Start of program
  606.  
  607.   SCRCLR
  608.   CR
  609.  
  610.   ."        **********************************************************"
  611.   CR 6 FPENSET
  612.   ."                           MULTI SPRITES DEMO                     "
  613.   CR 1 FPENSET
  614.   ."        **********************************************************"
  615.   CR
  616.   CR
  617.   ."        This code demonstrates how to create simple HeliOS multi"
  618.   CR
  619.   ."        sprites (or BOBs to be precise) and move them around."
  620.   CR
  621.   CR
  622.   ."        This code builds upon the following Demos:"
  623.   CR
  624.   CR
  625.   ."        Demo1_SinglePF.src"
  626.   CR
  627.   ."        Demo2_SinglePFCopper.src"
  628.   CR
  629.   ."        Demo3_SimpleSprite.src"
  630.   CR
  631.   CR
  632.   ."        This code is then expanded in the following Demos:"
  633.   CR
  634.   CR
  635.   ."        Demo5_MultiSptCollide.src"
  636.   CR
  637.   ."        Demo6_SimpleAnim.src"
  638.   CR
  639.   ."        Demo7_MultiAnim.src"
  640.   CR
  641.   ."        **********************************************************"
  642.   CR 6 FPENSET
  643.   ."                  Press <Space> or <L-Mouse> to see Demo"
  644.   CR 3 FPENSET
  645.   ."          Use a Joystick to move the gun turret and fire bullets"
  646.   CR
  647.   ."        **********************************************************"
  648.   CR
  649.  
  650.   WAITSPACE
  651.  
  652.   SCRCLR
  653.  
  654.   ERROR1 SETERROR"       \ Redirect system errors to our routine ERROR1
  655.  
  656.   CREATE_DSLICES
  657.   CREATE_RASINFO
  658.   CREATE_IMAGERY
  659.   CREATE_DISPLAY
  660.   CREATE_SLICECONTROL
  661.   CREATE_COPPER
  662.   CREATE_SPRITES
  663.  
  664.   HeliOS_On
  665.  
  666.   GunSpriteSet 8. D+ D@L INSTALLSPRITE
  667.  
  668.   1 FrameRate !L
  669.  
  670.   Display1 SHOWDISPLAY
  671.  
  672.   BEGIN
  673.     WAITFRAME
  674.  
  675.     Fire
  676.  
  677.     MoveGun
  678.  
  679.     ?TERMINAL 27 =
  680.   UNTIL
  681.  
  682.   -3 GunSpriteSet 8. D+ D@L SpriteCtrl_Flags INDEX!L
  683.  
  684.   Bullet# 0
  685.   DO
  686.     -3 BulletTable I 4* + D@ SpriteCtrl_Flags INDEX!L
  687.   LOOP
  688.  
  689.   5 DELAY
  690.  
  691.   HeliOS_Off
  692.  
  693.   CLOSEDOWN
  694.   ;
  695.  
  696.   TestDisplay
  697.  
  698.   \ *********************
  699.   \ End
  700.   \ *********************
  701.